<template>
  <div id="app">
    <!-- <transition mode="out-in">
			<router-view></router-view>
		</transition> -->
    <router-view></router-view>
    <TabBar v-if="$route.meta.ifShowTabbar" />
  </div>
</template>

<script>
import TabBar from './components/TabBar.vue'
export default {
  name: 'App',
  data() {
    return {
      aa: 0
    }
  },
  mounted() {
    if (!this.$store.state.isSelectCity) {
      this.$dialog
        .confirm({
          title: "定位失败",
          message: "无法获取当前城市定位，请手动选择所在城市",
          confirmButtonColor: '#ff5f16'
        })
        .then(() => {
          // 跳转到选择城市页面
          this.$router.push('/city')
      }).catch(err => err)
    }
  },
  components: {
    TabBar
  },
}

// 苹果设备禁止缩放
window.onload = function () {
  document.addEventListener("touchstart", function (event) {
    if (event.touches.length > 1) {
      event.preventDefault();
    }
  });
  document.addEventListener("gesturestart", function (event) {
    event.preventDefault();
  });
};

</script>

<style>
@import url("./assets/reset.css");
#app {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* background-color: #f4f4f4; */
  min-height: 100%;
  /* font-family: "黑体","宋体",sans-serif; */
  font-family: Microsoft YaHei, Tahoma, Helvetica, Arial, sans-serif;
}
body {
  font-size: 0.14rem;
  min-width: 320px;
  max-width: 800px;
  margin: 0 auto !important;
}

html,
body {
  height: 100%;
}

@media screen and (min-width: 120px) {
  html {
    font-size: 80px;
  }
}
@media screen and (min-width: 320px) {
  html {
    font-size: 100px;
  }
}
@media screen and (min-width: 410px) {
  html {
    font-size: 120px;
  }
}
@media screen and (min-width: 640px) {
  html {
    font-size: 150px;
  }
}

/* 路由切换动画区域 */
.v-enter,
.v-leave-to {
  opacity: 0;
  /* transform: translateX(10px); */
}
.v-enter-active,
.v-leave-active {
  transition: all 0.3s ease;
}
</style>
